/**
 * @Project TMHSC
 * @Author Tran Manh Hung
 * @Email: hungtmit@gmail.com | tmh@xwebgate.com
 * @Copyright © 2011 TMH. All rights reserved
 * @Createdate Jan 30, 2011
 * @Createtime 10:02:16 PM
 */

package com.tmh.study.aASA
{
	import flash.display.Sprite;

	/**
	 * Draw an 5 pointed star
	 */
	public class Star extends Sprite
	{
		public function Star(radius:Number, color:uint = 0xffff00):void
		{
			graphics.lineStyle(0);
			graphics.moveTo(radius, 0);
			graphics.beginFill(color);

			// draw 10 lines
			for (var i:int = 1; i < 11; i++)
			{
				var radius2:Number = radius;

				if (i % 2 > 0)
				{
					radius2 /= 2;
				}
				var angle:Number = Math.PI * 2 / 10 * i;
				graphics.lineTo(Math.cos(angle) * radius2, Math.sin(angle) * radius2);
			}
		}
	}
}